---
# Note(turkenh): It is not possible to get this generated by kubebuilder at the moment due to
# lack of support for objectSelector in controller-tools.
# See: https://github.com/kubernetes-sigs/controller-tools/blob/master/pkg/webhook/parser.go#L202-L212
apiVersion: admissionregistration.k8s.io/v1
kind: ValidatingWebhookConfiguration
metadata:
  name: crossplane-no-usages
webhooks:
  - admissionReviewVersions:
      - v1
    clientConfig:
      service:
        name: webhook-service
        namespace: system
        path: /validate-no-usages
    failurePolicy: Fail
    name: nousages.apiextensions.crossplane.io
    objectSelector:
      matchLabels:
        crossplane.io/in-use: "true"
    rules:
      - apiGroups:
          - '*'
        apiVersions:
          - '*'
        operations:
          - DELETE
        resources:
          - '*'
    sideEffects: None